import QtQuick 2.12
import QtQuick.Layouts 1.3

Rectangle {

    property alias lyrics: list.model
    property alias current: list.currentIndex

    id:lyricView
    Layout.preferredHeight: parent.height*0.8
    Layout.alignment: Qt.AlignCenter

    clip: true

    color: "#00000000"

    ListView
    {
        id:list
        anchors.fill: parent

        model:["暂无歌词", "11111111", "11111111111"]
        delegate: listDelegate
        // highlight: Rectangle{
        //     color: "#2073a7db"
        // }
        highlightMoveDuration: 0
        highlightResizeDuration: 0
        currentIndex: 0
        preferredHighlightBegin: parent.height/2-50
        preferredHighlightEnd: parent.height/2
        highlightRangeMode: ListView.StrictlyEnforceRange
    }

    Component
    {
        id:listDelegate
        Item {
            id: delegateItem
            width: list.width
            height: 50
            Text {

                text: modelData
                anchors.centerIn: parent
                color: index===list.currentIndex?"#eeffffff":"#aaffffff"
                font.family: window.m_FONT_FAMLIY
                font.pointSize: 12
            }
            states: State {

                when:delegateItem.ListView.isCurrentItem
                PropertyChanges {
                    target: delegateItem
                    scale:1.2

                }
            }
            MouseArea
            {
                anchors.fill: parent
                onClicked: list.currentIndex = index
            }
        }
    }
}
